package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.user.Collect;
import com.cskaoyan.service.CollectService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author dww
 */

@RestController
@RequestMapping("admin/collect")
public class CollectController {
    @Autowired
    private CollectService collectService;

    @RequestMapping("list")
    public BaseRespVo getList(Integer page, Integer limit, String sort, String order, Integer userId, Integer valueId) {
        List<Collect> list= collectService.getCollectList(page,limit,sort,order,userId,valueId);
        long total = PageInfo.of(list).getTotal();
        HashMap<String, Object> map = new HashMap<>();
        map.put("total",total);
        map.put("items",list);
        BaseRespVo<Object> respVo = new BaseRespVo<>(0, map, "成功");
        return respVo;
    }
}
